package com.zhang.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.zhang.entity.SetmealDrinkEntity;
import com.zhang.service.SetmealDrinkService;
import com.zhang.utils.PageUtils;
import com.zhang.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;








/**
 * 
 *
 * @author Haziy
 * @email 1143878025@qq.com
 * @date 2023-03-10 15:04:39
 */
@RestController
@RequestMapping("setmealDrink")
public class SetmealDrinkController {
    @Autowired
    private SetmealDrinkService setmealDrinkService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        List<SetmealDrinkEntity> entityList = setmealDrinkService.list();

        return R.ok().put("page", entityList);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		SetmealDrinkEntity setmealDrink = setmealDrinkService.getById(id);

        return R.ok().put("setmealDrink", setmealDrink);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody SetmealDrinkEntity setmealDrink){
		setmealDrinkService.save(setmealDrink);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public R update(@RequestBody SetmealDrinkEntity setmealDrink){
		setmealDrinkService.updateById(setmealDrink);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		setmealDrinkService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
